//
//  JJGroupChatSelectAtCell.swift
//  swiftProject
//
//  Created by yangjian on 2021/12/28.
//

import UIKit

class JJGroupChatMemberModel:NSObject {
    var atAll = false
    var username = ""
    var nickName = ""
    var gender = ""
    var headImageURLString = ""
}


class JJGroupChatSelectAtCell: UITableViewCell {

    var headImageView = UIImageView.init()
    var noteNameLabel = UILabel.init()
    var nickNameLabel = UILabel.init()
    var usernameLabel = UILabel.init()
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super .init(style: style, reuseIdentifier: reuseIdentifier)
        config()
    }
    func config(){
        self.contentView.addSubview(headImageView);
        self.contentView.addSubview(usernameLabel);
        self.contentView.addSubview(nickNameLabel);
        self.contentView.addSubview(noteNameLabel);
        
        self.headImageView.backgroundColor = UIColor.yellow;
        self.usernameLabel.backgroundColor = UIColor.orange;
        self.nickNameLabel.backgroundColor = UIColor.orange;
        self.noteNameLabel.backgroundColor = UIColor.orange;
        headImageView .snp.makeConstraints { make in
            make.top.equalTo(8);
            make.left.equalTo(10);
            make.bottom.equalTo(-8);
            make.width.equalTo(40);
            make.height.equalTo(40);
        }
        
        self.nickNameLabel.font = UIFont.systemFont(ofSize: 15, weight: .medium);
        self.nickNameLabel.snp.makeConstraints { make in
            make.top.equalTo(10);
            make.left.equalTo(self.headImageView.snp.right).offset(10);
            make.height.equalTo(20);
        }
        self.noteNameLabel.font = UIFont.systemFont(ofSize: 12, weight: .regular)
        self.noteNameLabel.snp.makeConstraints { make in
            make.top.equalTo(self.nickNameLabel.snp.bottom).offset(4);
            make.left.equalTo(self.headImageView.snp.right).offset(10);
        }
        
        self.contentView.addSubview(self.usernameLabel)
        self.usernameLabel.font = UIFont.systemFont(ofSize: 12, weight: .regular)
        self.usernameLabel.snp.makeConstraints { make in
            make.top.equalTo(self.nickNameLabel)
            make.right.equalTo(-10);
        }
        
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }
    func bindModel(model:JJGroupChatMemberModel){
//        self.headImageView.sd_setImage(with: URL(string: model.headImageURLString))
        self.nickNameLabel.text = model.nickName
        self.noteNameLabel.text = model.nickName
        self.usernameLabel.text = model.username
    }

}
